<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>用户中心</title>

		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!-- 引入css文件 -->
		<link rel="stylesheet" href=" ../css/sm.min.css">
		<link rel="stylesheet" href=" ../css/sm-extend.min.css">
		<link rel="stylesheet" href=" ../css/iconfont.css">
		<link rel="stylesheet" href="../css/forum-addTopic.css">

		<script src='../js/vue.js'></script>
		<script src='../js/axios.min.js'></script>
		<style type="text/css">
			/* 卡片内容加边距 */
			.my-cont {
				padding: .2rem .75rem;
			}
			/* 单张照片 */
			.my-cont .c1 img {
				width: 60%;
				margin: 0.5rem 0;
			}
			
			/* 两张照片 */
			.my-cont .c2 img {
				width: 40%;
				margin: 0.5rem 5%;
			}
			
			/* 三张照片及以上 */
			.my-cont .c3 img {
				width: 32%;
				margin: 0.5rem 0;
			}
			/* 用户动态信息上限 */
			.userMes{
				max-height: 3rem;
				overflow: hidden;
				font-size: 0.7rem;
			}
			/* 背景色白色 */
			.page,
			.page-group {
				background-color: white;
			}


			/* 去掉卡片边距 */
			.card {
				margin: 0;
			}

			.page {
				/* margin: 0.2rem; */
			}
			.list-block{
				margin-top: 0rem;
			}
			.card-content{
				padding-top: 0.5rem;
			}
			/* 用户字体 */
			.list-block .my-user {
				font-size: 0.6rem;
				color: rgb(150, 150, 150);
			}

			.list-block .media-list .item-title{
				font-size: 0.7rem;
				font-weight: 700;
			}
			/* 头像圆角 */
			.my-photo img {
				border-radius: 1rem;
			}


			/* 顶部搜索栏左间距 */
			.my-top {
				/* margin-left: 0.4rem; */
			}

			/* 卡片主内容左右边距 */
			.my-data {
				position: static;
				border-bottom: 1px solid rgb(220, 220, 220);
				padding-right: 60%;
				padding-left: 1rem;
				padding-bottom: 1rem;
			}

			/* 顶部社区样式 */
			/* 最外层 */
			.content {
				/* background-color: #3d005f; */
			}

			.content .native-scroll {
				background-color: white;
			}

			.my-top {
				height: 10rem;
				background-color: #2b93c5;
				padding: 1rem 0.5rem;
				padding-top: 0.3rem;
			}

			/* 搜索顶部工具栏 */
			#my-top-find {
				height: 1.5rem;
			}

			#my-top-find>div {
				float: right;
				height: 100%;
				text-align: center;
				line-height: 1.5rem;
			}

			
			/* 返回 */
			#my-top-find #return {
				position: absolute;
				height: 1.5rem;
			}

			/* 头像和简介外框 */
			#my-top-forum {
				margin-top: 0.3rem;
				height: 3rem;
			}

			#my-top-forum>div {
				float: left;
				height: 100%;
				color: white;
			}

			/* 社区头像 */
			#my-top-img {
				width: 3rem;
				height: 100%;
				border-radius: 1rem;
				overflow: hidden;
				margin-right: 1rem;
			}

			/* 社区头像内图片 */
			#my-top-img img {
				width: 100%;
				height: 100%;
			}

			/* 用户头像 */
			.user-photo img {
				/* width: 2rem;
				height: 2rem; */
				border-radius: 1rem;
			}

			/*  */
			#forumIntr {
				width: 65%;
			}

			/* 社区信息 */
			#my-top-name {
				padding-top: 0.3rem;
				width: 13rem;
				height: 1.2rem;
				line-height: 1.2rem;
				font-size: 0.7rem;
				font-weight: 700;
			}
			#forum-name{
				font-size: 0.65rem;
				margin-top: 0.4rem;
			}

			#my-top-intro {
				height: 0.9rem;
				font-size: 0.6rem;
				color: white;
				padding: 0.5rem;
			}
			
			/* 关注 */
			.concern {
				float: right;
				width: 3rem;
				height: 1rem;
				line-height: 1rem;
				font-size: 0.5rem;
				text-align: center;
				color: #0086bf;
				background-color: #e0fbff;
				border-radius: 0.4rem;

			}
			
			/* 用户其他信息 */
			#user-other{
				margin: 0;
				height: 2rem;
				margin-top: 1.2rem;
				color: white;
				font-size: 0.5rem;
			}
			/* 数字样式 */
			#user-other .userNum{
				font-size: 0.8rem;
				font-weight: 800;
				font-family: "微软雅黑";
			}
			/* 数字左间距 */
			.row .col-25{
				margin-left: 3%;
			}
			#user-other>div{
				text-align: center;
			}
			/* popup遮罩异常 */
			.modal-overlay.modal-overlay-visible,
			.popup-overlay.modal-overlay-visible,
			.preloader-indicator-overlay.modal-overlay-visible {
			
				visibility:inherit;
			}
			
			/* 图片 */
			.userImg {
				position: relative;
			}

			.userImg img {
				max-width: 100%;
				max-height: 100%;
			}

			.imgDel {
				position: absolute;
				top: 0.2rem;
				right: 0.32rem;
				font-size: 0.8rem;
			}

			
			a{
				color: inherit;
			}
			a:active{
				color: inherit;
			}
			/* 赞，回复数字 */
			.numType{
				font-size: 0.7rem;
				padding-right: 0.2rem;
				position: relative;
				top: 0.1rem;
			}
			/* 话题社区名称 */
			#user-forum{
				position: absolute;
				right: 1rem;
				color: #b5b5b5;
			}
			.row .col-33 {
			    padding-left: 0.6rem;
			}
			.popup .card-content {
			    /* margin-bottom: 1rem; */
			}
			.popup li {
			    height: 3rem;
			}
			.popup .card-content .userLi>div {
			    height: 100%;
			    padding: 0.25rem;
			    margin-left: 0.2rem;
			}
			.popup-concern img,.popup-fans img {
			    height: 100%;
			    width: 2.5rem;
			    border-radius: 1.25rem;
			}
			.popup .my-user {
			    margin-top: 0.3rem;
			    font-size: 0.7rem;
			}
			/* 取消细线 */
			.list-block ul:before{
				content:none;
			}
			.list-block ul:after{
				content:none;
			}
			.myContent .item-title-row .item-title {
			    /* font-family: "新宋体"; */
			    font-size: 0.7rem;
			}
			/* 弹框介绍宽度 */
			/* .popup .list-block .item-inner{
				width: 70%;
			} */
			.popup .card-content .userLi .concern{
				width: 4rem;
				height: 1rem;
				padding: 0.15rem;
				line-height: 0.8rem;
			}
			.popup .card-content .userLi .my-user{
				
			}
		</style>
		<style type="text/css">
			.infinite-scroll-preloader {
				margin-top: -20px;
			}
		</style>
	</head>
	<body>
		<!-- page 容器 -->
		<div id="page">
			
		<div class="page">
			<!-- 工具栏 -->
			<nav class="bar bar-tab">
				<a class="tab-item external" href="forum-index.html">
					<!-- <span class="icon icon-home"></span> -->
					<span class="icon iconfont icon-Moneymanagement"></span>
					<span class="tab-label">动态</span>
				</a>
				<a class="tab-item external" href="forum-community.html">
					<span class="icon iconfont icon-chengshi"></span>
					<span class="tab-label">社区</span>
				</a>
				<a class="open-popup tab-item external" data-popup=".popup-addTopic" href="#">
					<span class="icon iconfont icon-chuangzuo"></span>
					<span class="tab-label">发布</span>
				</a>
				<a class="tab-item external" href="forum-mes.html">
					<span class="icon iconfont icon-message"></span>
					<span class="tab-label">消息</span>
				</a>
				<a class="tab-item external active" href="#">
					<span class="icon iconfont icon-peoplelist"></span>
					<span class="tab-label">我的</span>
				</a>
			</nav>
			<!-- 这里是页面内容区 -->
			<div class="content">
				<!-- 顶部区域 -->
				<div class="my-top">
					<!-- 顶部栏 -->
					<div id="my-top-find">
						<!-- <div id="return" @click="returns()" style="color: white;">
							<a href="#">
								<span class="iconfont icon-fanhui"></span>
							</a>
						</div> -->
					</div>
					<!-- 社区展示 -->
					<div id="my-top-forum">
						<!-- 头像 -->
						<div id="my-top-img" v-if="user!=null">
							<img :src="imgSrc(user.user.photo)">
						</div>
						<!-- 介绍 -->
						<div id="forumIntr" v-if="user!=null">
							<div id="my-top-name">
								{{user.user.nickname}}
							</div>
							<div id="forum-name" v-if="user.forumForum!=null">
								<a :href="forum(user.forumForum.id)">
								{{user.forumForum.name}}
								</a>
							</div>
						</div>
					</div>
					<div id="my-top-intro" v-if="user!=null">
						<span>{{user.user.intro}}</span>
					</div>
					<div id="user-other" class="row" v-if="user!=null">
						<div class="col-25 open-popup"  data-popup=".popup-concern">
							<span class="userNum">{{centerUserNum}}</span><br>
							<span>关注</span>
						</div>
						<div class="col-25 open-popup" data-popup=".popup-fans">
							<span class="userNum">{{user.fansNum}}</span><br>
							<span>粉丝</span>
						</div>
						<div class="col-25">
							<span class="userNum">{{user.forumNum}}</span><br>
							<span>关注社区</span>
						</div>
						<div class="col-25">
							<span class="userNum">{{user.topicNum}}</span><br>
							<span>话题</span>
						</div>
					</div>
				</div>
				<!-- 标题栏 -->
				<div class="buttons-tab fixed-tab" data-offset="0">
					<a id="new" class="tab-link active button">发布</a>
					<a id="hot" class="button">回复</a>
					<a id="collect" class="button">收藏</a>
				</div>
				<!-- 主内容 -->
				<div class="active infinite-scroll" data-distance="50">
					<div class="list-block" style="margin-top: 0;">
						<div class="card list-container ">

							<!-- 社区 -->
							<!-- <div class="card-content">
								<div class="list-block media-list">
									<ul>
										<li class="item-content">
											<div class="item-media my-photo">
												<img src="http://gqianniu.alicdn.com/bao/uploaded/i4//tfscom/i3/TB10LfcHFXXXXXKXpXXXXXXXXXX_!!0-item_pic.jpg_250x250q60.jpg"
												 width="35">
											</div>
											<div class="item-inner">
												<div class="item-title-row">
													<div class="item-title">张三</div>
												</div>
												<div class="item-subtitle my-user">
													12：50
												</div>
											</div>
										</li>
									</ul>
								</div>
							</div> -->
							<!-- !-- 内容 -- -->
							<!-- <div class="my-cont">
								<span>
									安达市大所大所多安达市大所大所多安达市安达市大所大所多安达市大所大所多安达市大所大所多安达市大所大所多<br>
								</span>
								<span class="c1">
									<img src="http://localhost:12317/img/joylife/10.jpg">
								</span>
							</div>
							<div class="card-footer my-data">
								<span>5
									<span class="icon iconfont icon-appreciate"></span>
								</span>
								<span>5
									<span class="icon iconfont icon-message"></span>
								</span>
								<span>
									<span class="icon iconfont icon-forward"></span>
								</span>
								<div id="user-forum">
									清风社区
								</div>
							</div> -->

						</div>
					</div>
					<!-- 加载提示符 -->
					<div class="infinite-scroll-preloader">
						<div class="preloader"></div>
					</div>
				</div>
			</div>
		</div>
			<!-- About Popup -->
			<!-- 关注 -->
			<div class="popup popup-concern">
				<div class="content-block" style="margin-top: 0.5rem;">
					<!-- 工具栏 -->
					<div class="inform-top row" style="height: auto; margin-bottom: 0;">
						<div class="t1 col-33">
							<span class="close-popup iconfont icon-fanhui"></span>
						</div>
						<div class="t2 col-33">
							<span id="informName">我的关心</span>
						</div>
					</div>
					<div class="myContent" style="margin-top: 0.5rem;">
						
						<div class="card-content" v-for="item in attentionUser">
							<div class="list-block media-list" style="margin: 0;">
								<ul>
									<a>
									<li class="item-content userLi" style="padding: 0;">
										<div class="item-media my-photo">
											<a :href="userHtml(item.id)">
												<img :src="imgSrc(item.photo)" style="width: 2.5rem;height: 2.5rem;">
											</a>
										</div>
										<div class="item-inner">
											<div class="item-title-row">
												<div class="item-title">
													<span style="font-weight: 800;">{{item.nickname}}</span>
												</div>
											</div>
											<div class="item-subtitle my-user" style="color: #000000;">
												{{item.intro}}
											</div>
										</div>
										<div class="concern" @click="cancelConcern(item.id)">
											取消关注
										</div>
									</li>
									</a>
								</ul>
							</div>
						</div>
						
					</div>
				</div>
			</div>
			<!-- 粉丝弹窗 -->
			<div class="popup popup-fans">
				<div class="content-block" style="margin-top: 0.5rem;">
					<!-- 工具栏 -->
					<div class="inform-top row" style="height: auto; margin-bottom: 0;">
						<div class="t1 col-33">
							<span class="close-popup iconfont icon-fanhui"></span>
						</div>
						<div class="t2 col-33">
							<span id="informName">我的粉丝</span>
						</div>
					</div>
					<div class="myContent" style="margin-top: 0.5rem;">
						
						<div class="card-content" v-for="item in userFans">
							<div class="list-block media-list" style="margin: 0;">
								<ul>
									<a>
									<li class="item-content userLi" style="padding: 0;">
										<div class="item-media my-photo">
											<a :href="userHtml(item.userFans.id)">
												<img :src="imgSrc(item.userFans.photo)" style="width: 2.5rem;height: 2.5rem;">
											</a>
										</div>
										<div class="item-inner">
											<div class="item-title-row">
												<div class="item-title">
													<span style="font-weight: 800;">{{item.userFans.nickname}}</span>
												</div>
											</div>
											<div class="item-subtitle my-user" style="color: #000000;">
												{{item.userFans.intro}}
											</div>
										</div>
										
										<div class="concern" @click="concern(item.userFans.id)" v-if="item.status==0">
											关注
										</div>
										<div class="concern" @click="cancelConcern(item.userFans.id)" v-else>
											取消关注
										</div>
									</li>
									</a>
								</ul>
							</div>
						</div>
						
					</div>
				</div>
			</div>
		</div>
		<!-- 发布消息 -->
		<div class="popup popup-addTopic">
			<div class="content-block">
				<!-- 工具栏 -->
				<div class="addTopic-top row">
					<div class="t1 col-33">
						<span class="close-popup iconfont icon-fanhui"></span>
					</div>
					<div class="t2 col-33">
						<span>我的动态</span>
					</div>
					<div @click="addTopic" class="t3 col-33">
						<span>发布</span>
					</div>
				</div>
				<!-- 输入区域 -->
				<div id="addTopic-count" class="item-content list-block">
					<textarea id="topicContent" name="topicContent" maxlength="10000" required placeholder="尽情发挥吧..."></textarea>
				</div>
				<!-- 图片 -->
				<div id="addTopic-img" class="row">
					<div v-for="(item,index) in imgs" class="userImg col-33">
						<span @click="delImg(index)" class="imgDel iconfont icon-shanchu"></span>
						<img :src="imgSrc(item)">
					</div>
					<div v-if="imgs.length<3" class="userImg col-33">
						<!--  -->
						<form id="imgForm" method="post" enctype="multipart/form-data">
							<input type="file" @change="addImgMethod" id="addImg" name="img" accept="image/jpeg" />
						</form>
						<img src="../img/iconfont-tianjia.png">
					</div>
				</div>
			</div>
		</div>
		<script src='../js/jquery-3.2.1.min.js'></script>
		<script src='../js/sm.js'></script>
		<script src='../js/sm-extend.js'></script>
		<script src="../js/config.js"></script>
		<script src="../js/forum-addTopic.js"></script>
		<script>
			/* 获取请求参数 */
			function getUrlParam(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
				var r = window.location.search.substr(1).match(reg); //匹配目标参数
				if (r != null) return unescape(r[2]);
				return null; //返回参数值
			}
			var userId = getUrlParam('userId');
			//绑定vue
			var app = new Vue({
				el: "#page",
				data: {
					centerUserNum:0,
					user: null,
					attentionUser:null,
					userFans:null
				},
				created() {
					//加载用户基本信息
					axios.get(serviceIP+"/forum/findUserMes?centerUser=null",{headers:{"token":token,"refreshtoken":refreshtoken}}).then(result => {
						this.user = result.data;
						this.centerUserNum=result.data.concernNum;
					});
					//加载我的关注
					axios.get(serviceIP+"/forum/userContent?findUser=null",{headers:{"token":token,"refreshtoken":refreshtoken}}).then(result => {
						//console.log( result);
						this.attentionUser = result.data.data;
					});
					//加载我的粉丝
					axios.get(serviceIP+"/forum/userFans?findUser=null",{headers:{"token":token,"refreshtoken":refreshtoken}}).then(result => {
						//console.log(result.data.data);
						this.userFans = result.data.data;
					});
					
				},
				methods: {
					/* 头像 */
					imgSrc: function(src) {
						return imgSrc(src);
					},
					/* 社区跳转页面 */
					forum:function(href){
						return "forum-forum.html?forumId="+href;
					},
					/* 用户跳转页面 */
					userHtml:function(id){
						return "forum-other-centre.html?userId="+id;
					},
					/* 添加照片 */
					addImgMethod: function() {
						var path=$("#addImg").val();
						if(path!=null&&path!=""){
							var that = this;
							$.ajax({
								url: serviceIP+"/forum/addImg",
								type: "post",
								dataType: "json",
								cache: false,
								data: new FormData($("#imgForm")[0]),
								headers: {
											"token":token,
											"refreshtoken":refreshtoken
										},
								processData: false, // 不处理数据
								contentType: false, // 不设置内容类型
								success: function(data) {
									that.imgs.unshift(data.url);
								}
							});
						}
					},
					
					//关注
					concern: function(targetUserId) {
						axios.get(serviceIP+"/forum/concernsUser", {
							params: {
								targetUserId: targetUserId,
								status: 1
							},
							headers:{"token":token,"refreshtoken":refreshtoken}
						}).then(result => {
							if (result.data.data == 1) {
								$.toast("关注成功");
								this.centerUserNum++;
								//重新加载我的关注
								axios.get(serviceIP+"/forum/userContent?findUser=null",{headers:{"token":token,"refreshtoken":refreshtoken}}).then(result => {
									//console.log( result);
									this.attentionUser = result.data.data;
								});
								//加载我的粉丝
								axios.get(serviceIP+"/forum/userFans?findUser=null",{headers:{"token":token,"refreshtoken":refreshtoken}}).then(result => {
									//console.log(result.data.data);
									this.userFans = result.data.data;
								});
							} else {
								$.toast("失败，系统维护中");
							}
						});
					
					},
					//取消关注
					cancelConcern: function(targetUserId) {
						//alert(targetUserId);
						axios.get(serviceIP+"/forum/concernsUser", {
							params: {
								targetUserId: targetUserId,
								status: 0
							},
							headers:{"token":token,"refreshtoken":refreshtoken}
						}).then(result => {
							//console.log(result);
							if (result.data.data == 0) {
								$.toast("已取消");
								this.centerUserNum--;
								//重新加载我的关注
								axios.get(serviceIP+"/forum/userContent?findUser=null",{headers:{"token":token,"refreshtoken":refreshtoken}}).then(result => {
									//console.log( result);
									this.attentionUser = result.data.data;
								});
								//加载我的粉丝
								axios.get(serviceIP+"/forum/userFans?findUser=null",{headers:{"token":token,"refreshtoken":refreshtoken}}).then(result => {
									//console.log(result.data.data);
									this.userFans = result.data.data;
								});
							} else {
								$.toast("失败，系统维护中");
							}
						});
						
					},
					
					//返回
					returns: function() {
						window.history.go(-1);
						//location.href = "forum-index.html";
					}
				},
				//监听
				watch: {


				}
			});
		</script>
		<script type="text/javascript">
			//话题赞状态更改
			function alterPraise(that,topicId) {
			$.ajax({
				type: 'get',
				url: serviceIP+"/forum/alterTopicPraise",
				dataType: 'json',
					data:{
						topicId: topicId
					},
				headers: {
						"token":token,
						"refreshtoken":refreshtoken
					},
				success:function (data) {
						if(data.status==1){
							$(that).prev().html($(that).prev().html() * 1 + 1 * 1);
							$(that).attr("class", "icon iconfont icon-appreciate_fill_light");
							$.toast("已赞！");
						}else if(data.status==0){
							$(that).prev().html($(that).prev().html() * 1 - 1 * 1);
							$(that).attr("class", "icon iconfont icon-appreciate");
							$.toast("取消赞！");
						}
					}});
			}
			/* 发送时间计算 */
			function timeCount(time) {
				var num = new Date().getTime() - Date.parse(time);
				var date = new Date(Date.parse(time));
				//一小时以内
				if (num < 3600000) {
					return Math.ceil(num / 60000) + '分钟前';
				} else if (date.setHours(0, 0, 0, 0) == new Date().setHours(0, 0, 0, 0)) {
					//今天发送的
					return time.substring(11, 16);
				} else {
					//之前的信息
					return time.substring(0, 10);
				}
			}
			/* 图片地址 */
			function imgSrc(src){
				return  src;
			}
			/* 删除弹窗 */
			$(document).on('click','.create-actions', function () {
			      var buttons1 = [
			        {
			          text: '请选择',
			          label: true
			        },
			       {
			          text: '删除',
			          bold: true,
			         color: 'danger',
			          onClick: function() {
			            del();
			          }
			        },
			        {
			          text: '取消',
					  color: 'red'
			        }
			      ];
			      var groups = [buttons1];
			      $.actions(groups);
			  });
			var delId="";
			/* 删除内容赋值 */
			function delContentId(id){
				delId=id;
			}
			/* 删除话题和收藏 */
			function del(){
				//删除
			$.ajax({
					type: 'get',
					url: serviceIP+"/forum/delContent",
					dataType: 'json',
						data:{
							delId: delId,
							site: site
						},
					headers: {
							"token":token,
							"refreshtoken":refreshtoken
						},
					success:function (data) {
						if(data.data==1){
							$.toast("已删除");
							//刷新
							lastIndex = 1;
							type=0;
							$('.infinite-scroll .list-container').html("");
							$.attachInfiniteScroll($('.infinite-scroll'));
							aja();
						}else{
							$.toast("失败，系统维护中");
						}
					}});
			}
		</script>
		<script type="text/javascript">
			//所有图片数据
			var allPhoto={};
			//当下图片浏览器数据
			var newphotos=new Array();
			$(function(){
			   $(document).on('click','.pb-popup',function () {
				 var myPhotoBrowserPopup = $.photoBrowser({
					   photos :newphotos,
					   type: 'popup'
				});
				myPhotoBrowserPopup.open();
			   });
			})
			/* 切换照片数组 */
			function changePhoto(id){
				newphotos=allPhoto[id];
				//console.log(newphotos);
			}
		</script>
		<script>
			// 加载flag
			var loading = false;
			// 最多可加载的条目
			var maxItems = 100;
			// 每次加载添加多少条目
			var itemsPerLoad = 5;
			// 初始页
			var lastIndex = 1;
			//当前位置
			var site = 1;
			//加载类型
			var type = 0;
			// 生成新条目的HTML
			function addItems(topic) {
				var html = '<div class="card-content">' +
					'<div class="list-block media-list">' +
					'<ul>' +
					'<li class="item-content">' +
					'<div class="item-media user-photo">';
					if(site==3){
						html+='<a href="forum-other-centre.html?userId='+topic.centerUser.id+'">';
					}
					html+='<img src="' + topic.centerUser.photo + '" width="35" height="35">';
					if(site==3){
						html+='</a>';
					}
					html+='</div>' +
					'<div class="item-inner">' +
					'<div class="item-title-row">' +
					'<div class="item-title">' + topic.centerUser.nickname + '</div>' +
					'</div>' +
					'<div class="item-subtitle my-user">';

				// 判断日期时间
				var num = new Date().getTime() - Date.parse(topic.forumTopic.date);
				var date = new Date(Date.parse(topic.forumTopic.date));
				//一小时以内
				if (num < 3600000) {
					html += '<span>' + Math.ceil(num / 60000) + '分钟前</span>';
				} else if (date.setHours(0, 0, 0, 0) == new Date().setHours(0, 0, 0, 0)) {
					//今天发送的
					html += '<span>' + topic.forumTopic.date.substring(11, 16) + '</span>';
				} else {
					//之前的信息
					html += '<span>' + topic.forumTopic.date.substring(0, 10) + '</span>';
				}

				html += '</div>' +
					'</div>' +
					'</li>' +
					'</ul>' +
					'</div>' +
					'</div>' +
					'<div class="my-cont">' +
					'<a href="forum-Topic.html?topicId='+topic.forumTopic.id+'"><div class="userMes"><span>' + topic.forumTopic.content + '</div></a>' +
					'</span>';
				// 判断照片数量
				if (topic.forumPhotos.length == 1) {
					html += '<span class="c1">' +
						'<img class=" pb-popup" onclick="changePhoto(\''+topic.forumTopic.id+'\')" src="'+ topic.forumPhotos[0].photo + '">' +
						'</span>';
				} else if (topic.forumPhotos.length == 2) {
					html += '<span class="c2">' +
						'<img class=" pb-popup" onclick="changePhoto(\''+topic.forumTopic.id+'\')" src="'+ topic.forumPhotos[0].photo + '">' +
						'<img class=" pb-popup" onclick="changePhoto(\''+topic.forumTopic.id+'\')" src="'+ topic.forumPhotos[1].photo + '">' +
						'</span>';
				} else if (topic.forumPhotos.length == 3) {
					html += '<span class="c3">' +
						'<img class=" pb-popup" onclick="changePhoto(\''+topic.forumTopic.id+'\')" src="'+ topic.forumPhotos[0].photo + '">' +
						'<img class=" pb-popup" onclick="changePhoto(\''+topic.forumTopic.id+'\')" src="'+ topic.forumPhotos[1].photo + '">' +
						'<img class=" pb-popup" onclick="changePhoto(\''+topic.forumTopic.id+'\')" src="'+ topic.forumPhotos[2].photo + '">' +
						'</span>';
				}
				//保存图片
				if(topic.forumPhotos!=null&&topic.forumPhotos.length!=0){
					var tempPhoto=new Array();
					$.each(topic.forumPhotos, function(i, item) {
						tempPhoto.push(item.photo);
					}); 
					//保存
					allPhoto[topic.forumTopic.id]=tempPhoto;
				}
				html += '</div>' +
					'<div class="card-footer my-data">' +
					'<span><span class="numType">' + topic.praiseNum +
					'</span><span onclick="alterPraise(this,\'' + topic.forumTopic.id +
					'\')"  class="';
				/* 判断是否点赞 */
					if(topic.status==1){
						html +='icon iconfont icon-appreciate_fill_light"></span>';
					}else{
						html +='icon iconfont icon-appreciate"></span>';
					}
					html +='</span>' +
					'<span><span class="numType">' + topic.replyNum +
					'</span><a href="forum-Topic.html?topicId='+topic.forumTopic.id+'"><span class="icon iconfont icon-message"></span>' +
					'</a></span>' +
					'<span>' +
					'<span onclick="delContentId(\''+topic.forumTopic.id+'\')" class="icon iconfont icon-icon_more create-actions"></span>' +
					'</span>' +
					'<div id="user-forum"><a href="forum-forum.html?forumId='+topic.forumForum.id+'">' +
						topic.forumForum.name +
					'</a></div>' +
					'</div>';

				// 添加新条目
				$('.infinite-scroll .list-container').append(html);
			}
			// 回复类加载的HTML
			function addItems2(replyMes) {
				html='<div class="card-content">'
				+'	<div class="list-block media-list">'
				+'		<ul>'
				+'			<li class="item-content">'
				+'				<div class="item-media my-photo">'
				+'					<img src="'+imgSrc(replyMes.centerUser.photo)+'"'
				+'					 width="35" height="35">'
				+'				</div>'
				+'				<div class="item-inner">'
				+'					<div class="item-title-row">'
				+'						<div class="item-title">'
				+'							<span style="font-weight: 800;">'+replyMes.centerUser.nickname+'</span>'
				+'						</div>'
				+'					</div>'
				+'					<div class="item-subtitle my-user">'
				+						timeCount(replyMes.forumReply.date)
				+'					</div>'
				+'				</div>'
				+'			</li>'
				+'		</ul>'
				+'	</div>'
				+'</div>'
				<!--回复内容 -->
				+'<div class="my-cont">'
				+'	<!-- 回复 -->'
				+'	<div id="" style="margin-top: 0rem;">'
				+'		<span style="font-size: 0.75rem;">'
				+		'<a href="forum-Topic.html?topicId='+replyMes.forumReply.topicId+'">'+replyMes.forumReply.content
				+'		</a></span>'
				+'	</div>'
				+'	<div id="my-content" style="border: rgb(170, 170, 170) 1px solid; border-radius: 0.5rem; padding: 0.2rem;">'
				+'		<span style="font-size: 0.6rem;color: rgb(222, 144, 0);">';
				
				if(replyMes.forumReply.replyId==null){
					html+='原话题 >';
				}else{
					html+='原回复 >';
				}		
				
				html+='		</span>'
				+'		<span style="font-size: 0.7rem;color: rgb(121, 121, 121);">'
				+			'<a href="forum-Topic.html?topicId='+replyMes.forumReply.topicId+'">'+replyMes.content+'</a><br>'
				+'		</span>'
				+'	</div>'
				+'</div>';
			
				// 添加新条目
				$('.infinite-scroll .list-container').append(html);
			}
			//异步请求封装
			function aja() {
				// 如果正在加载，则退出
				if (loading) return;
				// 设置flag
				loading = true;
				//请求加载信息
				$.ajax({
					type: 'get',
					url: serviceIP+"/forum/userTopicMes",
					dataType: 'json',
						data:{
							page: lastIndex,
							limit: itemsPerLoad,
							findUserId: userId,
							site: site
						},
					headers: {
							"token":token,
							"refreshtoken":refreshtoken
						},
					success:function (data) {
						//console.log(data.data);
						
						// 重置加载flag
						loading = false;
						//页面遍历添加
						if(type==0){
							$.each(data.data.list, function(i, item) {
								addItems(item);
							});
						}else{
							$.each(data.data.list, function(i, item) {
								addItems2(item);
							});
						}
						// 更新最后加载的序号
						lastIndex++;
						//无数据
						if (data.data.size < itemsPerLoad) {
							// 删除加载提示符
							$('.infinite-scroll-preloader').remove();
						}
						if (data.data.size < 1) {
							// 加载完毕，则注销无限加载事件，以防不必要的加载
							$.detachInfiniteScroll($('.infinite-scroll'));
							// 删除加载提示符
							$('.infinite-scroll-preloader').remove();
							//提醒
							$.toast("没更多消息了，看看别的吧！");
							return;
						}
						//容器发生改变,如果是js滚动，需要刷新滚动
						$.refreshScroller();
						
					}
				});
			}
			// 注册'infinite'事件处理函数
			$(document).on('infinite', function() {
				aja();
			});
			aja();
			//切换最新页面
			$("#new").click(function() {
				if (site != 1) {
					site = 1;
					lastIndex = 1;
					type=0;
					allPhoto={};
					$('.infinite-scroll .list-container').html("");
					$("#new").attr("class", "tab-link active button");
					$("#hot").attr("class", "button");
					$("#collect").attr("class", "button");
					$.attachInfiniteScroll($('.infinite-scroll'));
					aja();
				}
			});
			//切换最热页面
			$("#hot").click(function() {
				if (site != 2) {
					site = 2;
					lastIndex = 1;
					type=1;
					allPhoto={};
					$('.infinite-scroll .list-container').html("");
					$("#new").attr("class", "button");
					$("#hot").attr("class", "tab-link active button");
					$("#collect").attr("class", "button");
					$.attachInfiniteScroll($('.infinite-scroll'));
					aja();
				}
			});
			//切换多收藏页面
			$("#collect").click(function() {
				if (site != 3) {
					site = 3;
					lastIndex = 1;
					type=0;
					allPhoto={};
					$('.infinite-scroll .list-container').html("");
					$("#new").attr("class", "button");
					$("#hot").attr("class", "button");
					$("#collect").attr("class", "tab-link active button");
					$.attachInfiniteScroll($('.infinite-scroll'));
					aja();
				}
			});
		</script>
		<script>
			$.init();
		</script>
	</body>

</html>
